import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'Layout',
    component: () => import('../views/Layout'),
    children: [
      {
        path: '',
        name: 'Home',
        component: () => import('../views/Home')
      }
      // {
      //   path: '/category/:id',
      //   name: 'Category',
      //   component: () => import('../views/Category')
      // },
      // {
      //   path: '/category/sub/:id',
      //   component: () => import('@/views/Category/Sub')
      // },
      // {
      //   path: '/goods/:id',
      //   component: () => import('@/views/Goods')
      // }
    ]
  },
  {
    path: '/about',
    name: 'about',
    component: () =>
      import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
  // 刷新行为时，回到顶部
  scrollBehavior: () => ({ x: 0, y: 0 })
})

export default router
